package com.ruoyi.airspaceFlight.controller;

import com.ruoyi.airspaceFlight.domain.TAirspaceType;
import com.ruoyi.airspaceFlight.service.TAirspaceTypeService;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 空域类型Controller
 * 
 * @author SUNLIANG
 * @date 2023/11/1
 */
@RestController
@RequestMapping("/airspaceType")
public class TAirspaceTypeController extends BaseController
{
    @Autowired
    private TAirspaceTypeService tAirspaceTypeService;

    /**
     * 查询空域类型列表
     */
//    @RequiresPermissions("airspaceFlight:airspaceType:list")
    @GetMapping("/list")
    public AjaxResult list()
    {
        List<TAirspaceType> list = tAirspaceTypeService.selectTAirspaceTypeList();
        return AjaxResult.success(list);
    }


    /**
     * 新增空域类型
     */
//    @RequiresPermissions("airspaceFlight:airspaceType:add")
//    @Log(title = "空域类型", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    public AjaxResult add(@RequestBody TAirspaceType tAirspaceType)
    {
        return toAjax(tAirspaceTypeService.insertTAirspaceType(tAirspaceType));
    }

    /**
     * 修改空域类型
     */
//    @RequiresPermissions("airspaceFlight:airspaceType:edit")
//    @Log(title = "空域类型", businessType = BusinessType.UPDATE)
    @PutMapping("/edit")
    public AjaxResult edit(@RequestBody TAirspaceType tAirspaceType)
    {
        return toAjax(tAirspaceTypeService.updateTAirspaceType(tAirspaceType));
    }

    /**
     * 获取空域类型详细信息
     */
//    @RequiresPermissions("airspaceFlight:airspaceType:query")
    @GetMapping(value = "getInfo/{airTypeId}")
    public AjaxResult getInfo(@PathVariable("airTypeId") String airTypeId)
    {
        return AjaxResult.success(tAirspaceTypeService.selectTAirspaceTypeByAirTypeId(airTypeId));
    }

    /**
     * 删除空域类型
     */
//    @RequiresPermissions("airspaceFlight:airspaceType:remove")
//    @Log(title = "空域类型", businessType = BusinessType.DELETE)
	@DeleteMapping("remove/{airTypeId}")
    public AjaxResult remove(@PathVariable("airTypeId") String airTypeId)
    {
        return AjaxResult.success(tAirspaceTypeService.deleteTAirspaceTypeByAirTypeId(airTypeId));
    }


}
